package cn.kgc.searchservice.dao;

import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Repository
public class SearchDaoImpl implements SearchDao {

    @Autowired
    private RestHighLevelClient restHighLevelClient;

    @Value("${elasticsearch.index}")
    private String indexName;

    /**
     * PUT news/_mapping
     * {
     *   "properties": {
     *     "newsId": {
     *       "type": "integer"
     *     },
     *     "newsName": {
     *       "type": "text",
     *       "analyzer": "ik_smart",
     *       "search_analyzer": "ik_smart"
     *     },
     *     "summary": {
     *       "type": "text",
     *       "analyzer": "ik_smart",
     *       "search_analyzer": "ik_smart"
     *     },
     *     "content": {
     *       "type": "keyword"
     *     },
     *     "userId": {
     *       "type": "integer"
     *     }
     *     "createDate": {
     *       "type": "date"
     *     },
     *     "commentNum": {
     *       "type": "integer"
     *     },
     *     "readNum": {
     *       "type": "integer"
     *     },
     *     "categoryId": {
     *       "type": "integer"
     *     },
     *     "img": {
     *       "type": "keyword"
     *     },
     *     "category": {
     *       "type": "object"
     *     }
     *   }
     * }
     */

    @Override
    public List<Map<String, Object>> getNews(String keyword) {
        List<Map<String, Object>> list = new ArrayList<>();

        return list;
    }
}
